#ifndef DBMANAGER_H
#define DBMANAGER_H

#include <QObject>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QString>

class DBManager : public QObject
{
    Q_OBJECT
public:
    static DBManager& getInstance();
    bool openDatabase(const QString &dbName);
    bool isOpen() const;
    QSqlQuery execQuery(const QString &query);
    void closeDatabase();
public:
    // 新增一个执行带参数SQL插入的方法
    bool insertIntoIconTable(const QString &name, const QString &path);
    ~DBManager();

private:
    DBManager();
    DBManager(const DBManager&) = delete;
    DBManager& operator=(const DBManager&) = delete;
    QSqlDatabase db;
    QString m_dbName;

signals:

};

#endif // DBMANAGER_H
